getFont

@Nullable
open fun getFont(@StyleableRes index: Int, style: Int, fontCallback: @Nullable ResourcesCompat.FontCallback): @Nullable Typeface(source)

Retrieve the Typeface for the attribute at index.

This method will throw an exception if the attribute is defined but is not a font.

Return

Typeface for the attribute, or null if not defined.

Parameters

index

Index of attribute to retrieve.

style

A style value used for selecting best match font from the list of family. Note that this value will be ignored if the platform supports font family (API 24 or later).

fontCallback

A callback to receive async fetching of this font. If async loading is specified in XML, this callback will be triggered.

Throws

if the TypedArray has already been recycled.

if the attribute is defined but is not a font resource.